var wxpay = require('../../utils/pay.js')
var app = getApp();
Page({
    data:{
      orderId:0,
      orderDetail:{},
      showLogistics:false
    },
    
    onLoad:function(e){
      var that = this;
      var orderId = e.id;
      that.setData({
        orderId: orderId
      });
    },

    onShow : function () {
      var that = this;
      wx.request({
        url: app.globalData.host + '/api/order/GetOrder',
        data: {
          uid: app.globalData.userInfo.Uid,
          oid: that.data.orderId
        },
        success: (res) => {
          wx.hideLoading();
          if (res.data.Code != 0) {
            wx.showModal({
              title: '提示',
              content: res.data.Message,
              showCancel: false
            })
            return;
          }
          var order = res.data.Data;
          for (var i = 0; i < order.OrderProductList.length; i++) {
            order.OrderProductList[i].Info.ShowImg = app.globalData.image190_190host + order.OrderProductList[i].Info.ShowImg;
            
          }
          if ((order.OrderInfo.Sid).replace(/(^\s*)|(\s*$)/g, "") == ""){
            var showLogistics = true//显示物流信息线上订单
          }else{
            var showLogistics = false//隐藏物流信息线下订单
          }
          that.setData({
            orderDetail: order,
            showLogistics: showLogistics
          });
        }
      })
    },
    
    wuliuDetailsTap:function(e){
      var orderId = e.currentTarget.dataset.id;
      wx.navigateTo({
        url: "/pages/wuliu/index?oid=" + orderId
      })
    },

    onPullDownRefresh: function () {
      // 页面相关事件处理函数--监听用户下拉动作
      wx.stopPullDownRefresh();
    }
})